#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
	int s, a, b, x;
	cin >> s >> a >> b >> x;

	int r = x / (a + b);
	int o = x % (a + b);

	ll ans = r * s * a + (min(o, a) * s);

	cout << ans << endl;
}